package com.pubinfo.passbook.api.controller.bill;

import com.pubinfo.passbook.common.entity.TMdmCostCenter;
import com.pubinfo.passbook.common.entity.TMdmSupplier;
import com.pubinfo.passbook.common.model.dto.MDM.MdmCostCenterParam;
import com.pubinfo.passbook.common.model.dto.MDM.MdmParam;
import com.pubinfo.passbook.common.model.dto.MDM.MdmSapSupplierParam;
import com.pubinfo.passbook.common.model.vo.base.JsonResult;
import com.pubinfo.passbook.common.model.vo.base.MyPage;
import com.pubinfo.passbook.common.service.master.ITMdmCostCenterService;
import com.pubinfo.passbook.common.service.master.ITMdmSupplierService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "mdm/manager")
@Api(tags = "记账成本管理")
@Slf4j
public class TMdmController {
  
  @Resource
  private ITMdmCostCenterService costCenterService;
  @Resource
  private ITMdmSupplierService supplierService;
  
  @PostMapping("select")
  @ApiModelProperty(value = "查询记账成本中心信息")
  public JsonResult<MyPage<TMdmCostCenter>> selectMdmCostCenter(@RequestBody MdmCostCenterParam param) {
    return JsonResult.success(new MyPage(costCenterService.selectMdmCostCenter(param)));
  }
  
  @PostMapping("list")
  @ApiModelProperty(value = "列出记账成本中心信息")
  public JsonResult<MyPage<TMdmCostCenter>> listMdmCostCenter(@RequestBody MdmParam param) {
    return JsonResult.success(new MyPage(costCenterService.listMdmCostCenter(param)));
  }
  
  @PostMapping("selectSapSupplier")
  @ApiModelProperty(value = "查询Sap供应商信息")
  public JsonResult<MyPage<TMdmSupplier>> selectSapSupplier(@RequestBody MdmSapSupplierParam param) {
    return JsonResult.success(new MyPage(supplierService.selectSupplier(param)));
  }
  
}
